$OpenBSD: patch-Makefile,v 1.5 2014/04/30 05:09:29 dcoppa Exp $
--- Makefile.orig	Mon Dec  9 21:52:28 2013
+++ Makefile	Wed Apr 30 07:05:05 2014
@@ -5,8 +5,8 @@
 # http://miniupnp.free.fr/libnatpmp.html
 
 OS = $(shell uname -s)
-CC = gcc
-INSTALL = install -p
+CC ?= gcc
+INSTALL ?= install -p
 ARCH = $(shell uname -m | sed -e s/i.86/i686/)
 VERSION = $(shell cat VERSION)
 
@@ -49,9 +49,9 @@ ifneq (,$(findstring WIN,$(OS)))
   CC = i686-w64-mingw32-gcc
   EXTRA_LD = -lws2_32 -lIphlpapi -Wl,--no-undefined -Wl,--enable-runtime-pseudo-reloc --Wl,kill-at
 else
-  SHAREDLIB = libnatpmp.so
+  SHAREDLIB ?= libnatpmp.so
   JNISHAREDLIB = libjninatpmp.so
-  SONAME = $(SHAREDLIB).$(APIVERSION)
+  SONAME ?= $(SHAREDLIB).$(APIVERSION)
   SONAMEFLAGS=-Wl,-soname,$(JNISHAREDLIB)
 endif
 endif
@@ -93,13 +93,12 @@ depend:
 
 install:	$(HEADERS) $(STATICLIB) $(SHAREDLIB) natpmpc-shared
 	$(INSTALL) -d $(INSTALLDIRINC)
-	$(INSTALL) -m 644 $(HEADERS) $(INSTALLDIRINC)
+	$(INSTALL_DATA) $(HEADERS) $(INSTALLDIRINC)
 	$(INSTALL) -d $(INSTALLDIRLIB)
-	$(INSTALL) -m 644 $(STATICLIB) $(INSTALLDIRLIB)
-	$(INSTALL) -m 644 $(SHAREDLIB) $(INSTALLDIRLIB)/$(SONAME)
+	$(INSTALL_DATA) $(STATICLIB) $(INSTALLDIRLIB)
+	$(INSTALL_DATA) $(SHAREDLIB) $(INSTALLDIRLIB)/$(SONAME)
 	$(INSTALL) -d $(INSTALLDIRBIN)
-	$(INSTALL) -m 755 natpmpc-shared $(INSTALLDIRBIN)/natpmpc
-	ln -s -f $(SONAME) $(INSTALLDIRLIB)/$(SHAREDLIB)
+	$(INSTALL_PROGRAM) natpmpc-shared $(INSTALLDIRBIN)/natpmpc
 
 $(JNIHEADERS): fr/free/miniupnp/libnatpmp/NatPmp.class
 	$(JAVAH) -jni fr.free.miniupnp.libnatpmp.NatPmp
@@ -165,7 +164,7 @@ $(SHAREDLIB):	$(LIBOBJS)
 ifeq ($(OS), Darwin)
 	$(CC) -dynamiclib -Wl,-install_name,$(SONAME) -o $@ $^
 else
-	$(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^ $(EXTRA_LD)
+	$(CC) -shared -o $@ $^ $(EXTRA_LD)
 endif
 
 
